package cn.exrick.xboot.modules.backlogOrFullList.utils;

import cn.exrick.xboot.common.jiuqiCommon.callAPIUtil.CallApiUtil;
import cn.exrick.xboot.modules.base.entity.User;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

import static cn.exrick.xboot.common.jiuqiCommon.callAPIUtil.CallApiUtil.getRandom4;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: njp
 * @Date: 2020/07/06/9:24
 * @Description:
 */
@Service
@Slf4j
public class BacklogUtile {

    /*public static  JSONArray parseBacklogJson( JSONObject jsonInfo){
        //JSONObject jsonInfo = JSON.parseObject(info);
        JSONArray arr = jsonInfo.getJSONArray("datas");
        return arr;
    }*/

    /**
     *
     * @param userlist
     * @return
     */
    public  JSONObject javaToJSON(List<User> userlist) {
        JSONObject jsonObj = new JSONObject();
        List<BacklogUtile.UserBL> users=new ArrayList<>();
        for (int i = 0; i <userlist.size() ; i++) {
            BacklogUtile.UserBL ut=new BacklogUtile.UserBL(userlist.get(i).getIdcard());
            users.add(ut);
        }
        jsonObj.put("datas", users);
        log.info(jsonObj.toString());
        return jsonObj;
    }


    @Data
    class UserBL{
        private String usercode;
        public   UserBL(String usercode){
            this.usercode=usercode;
        }
    }


}
